import { View } from "../../../mvc/core/View";
import { Dispatcher } from "../../../mvc/core/Dispatcher";
import { EventName } from "../../mvc/EventName";
import { GTextFormat } from "../../../common/GTextFormat";
import { FontUtil } from "../../../common/font/FontUtil";
import { ObjCreate } from "../common/ObjCreate";
import { Language } from "../../../../extend/language/Language";
import { SWFPlayer } from "../../scene/modle/SWFPlayer";
import { ModelType } from "../../scene/modle/data/ModelType";
import { DataEvent } from "../../events/DataEvent";
type int = number;
//class XpSkillTipPanel
    
    export  class XpSkillTipPanel extends View
    {
        constructor()
        {
            super();
            this.init();
            Dispatcher.addEventListener(EventName.FireXpSkillComplete, this.onFireXpSkillCompleteHandler);
            return;
        }

        /* internal  */init(): void
        {
            var loc1=new GTextFormat(FontUtil.songtiName, 16, 16777215, true);
            this._tip1 = ObjCreate.createTextField(Language.getString(51036), 0, 0, 220, 25, this, loc1);
            this._tip1.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this._cx = this._cx + this._tip1.width;
            this._effectPlayer = new SWFPlayer();
            this._effectPlayer.load("X.swf", ModelType.NormalSwf, null);
            this._effectPlayer.move(this._cx + 25, 10);
            this.addChild(this._effectPlayer);
            this._cx = this._cx + 45;
            this._tip2 = ObjCreate.createTextField(Language.getString(51037), this._cx, 0, 220, 25, this, loc1);
            this._tip2.autoSize = flash.text.TextFieldAutoSize.LEFT;
            return;
        }

        public startTimer(): void
        {
            if (this.timer == null) 
            {
                this.timer = new Object /* flash.utils.Timer */(1000);
                this.timer.repeatCount = 10;
                this.timer.addEventListener(flash.events.TimerEvent.TIMER_COMPLETE, this.onTimerCompleteHandler);
            }
            this.timer.reset();
            this.timer.start();
            return;
        }

        /* internal  */onTimerCompleteHandler(arg1: Object /* flash.events.Event */): void
        {
            if (this.timer) 
            {
                this.timer.stop();
            }
            if (this.parent) 
            {
                this.parent.removeChild(this);
            }
            return;
        }

        /* internal  */onFireXpSkillCompleteHandler(arg1: DataEvent): void
        {
            this.onTimerCompleteHandler(null);
            return;
        }

        /* internal */ /* var */_tip1: Object /* flash.text.TextField */;

        /* internal */ /* var */_tip2: Object /* flash.text.TextField */;

        /* internal */ /* var */_effectPlayer: SWFPlayer;

        /* internal */ /* var */_cx: int;

        /* internal */ /* var */timer: Object /* flash.utils.Timer */;
    }
